home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Word / C / CoTemplatesDemo.cpt / Buttons / Clipped Button / Clipped Button
Encoding:
Text File  |  1989-02-04  |  2.7 KB  |  152 lines  |  [CTPP/CTMP]

  1. % button text
  2. % Gregory Kruckewitt
  3. % 3-March-87
  4. % var for fill  page
  5. /TM 496 def
  6. /BM 296 def
  7. /LM 206 def
  8. /RM 406 def
  9. /newline
  10. { currentpoint Size3 1.20 mul sub
  11. exch pop LM
  12. exch moveto } def
  13.  
  14. /nllfNec
  15. { currentpoint pop RM gt
  16. {newline} if } def
  17.  
  18. /done?
  19. { currentpoint exch pop BM lt } def
  20.  
  21. /fillpage
  22. /strg exch def
  23. { { pop pop nllfNec} strg kshow
  24. done? {exit} if
  25. } loop
  26.  } def
  27. /outsidecircletext
  28.     {circtextdict begin
  29.         /radius exch def
  30.         /centerangle exch def
  31.         /ptsize exch def
  32.         /str exch def
  33.         /xradius radius ptsize 4 div add def
  34.  
  35.     gsave
  36.     centerangle str findhalfangle add rotate
  37.  
  38. str
  39. {/charcode exch def
  40.         ( ) dup 0 charcode put outsideplacechar
  41. }forall
  42.     grestore
  43.     end
  44. }def
  45.  
  46. /insidecircletext
  47. {circtextdict begin
  48.         /radius exch def  /centerangle exch def
  49.         /ptsize exch def  /str exch def
  50.  
  51.     /xradius radius ptsize 3 div sub def
  52.     gsave
  53.   centerangle str findhalfangle sub rotate
  54. str
  55.  {/charcode exch def
  56.             ( ) dup 0 charcode put insideplacechar
  57. }forall
  58. grestore
  59. end
  60. }def
  61.  
  62. /circtextdict 16 dict def
  63.     circtextdict begin
  64. /findhalfangle
  65.         {stringwidth pop 2 div
  66.   2 xradius mul pi mul div 360 mul
  67. }def
  68.  
  69.  
  70. /outsideplacechar
  71. {/char exch def
  72.     /halfangle char findhalfangle def
  73. gsave
  74.         halfangle neg rotate
  75.     radius 0 translate
  76.     -90 rotate
  77.     char stringwidth pop 2 div neg 0 moveto
  78. char show
  79. grestore
  80. halfangle 2 mul neg rotate
  81. }def
  82.  
  83. /insideplacechar
  84. {/char exch def
  85.     /halfangle char findhalfangle def
  86.     gsave
  87.     halfangle rotate
  88.     radius 0 translate
  89.     90 rotate
  90.         char stringwidth pop 2 div neg 0 moveto
  91.     char show
  92.     grestore
  93.     halfangle 2 mul rotate
  94. }def
  95.  
  96.     /pi 3.1415923 def
  97. end
  98.  
  99. /Badge         
  100.     {
  101.     Fontname1 findfont Size1 scalefont setfont
  102.  
  103.     topline % top of circle text var from turbo
  104.  
  105.     Size1 90 65 outsidecircletext
  106.     Fontname2 findfont Size2 scalefont setfont
  107.  
  108.     bottomline % bottom of circle text var from turbo
  109.  
  110.     Size2 270 70 insidecircletext
  111.     
  112. } def
  113. /cutline
  114. {newpath  .5 setgray 0 0 98 0 360 arc   closepath clip} def   % stroke 0 setgray draw circle?
  115. /cutline2
  116. {newpath  .5 setgray 0 0 98 0 360 arc  stroke closepath } def   % stroke 0 
  117. /fitit % auto sizing routine
  118. { /str exch def
  119.   /size exch def
  120. { size 1 sub
  121. Fontname4 findfont size scalefont setfont
  122. str dup stringwidth pop 145 gt 
  123. { fitit size Name} { exit} ifelse
  124. } loop
  125. } def
  126. % START THE PROCESS
  127. gsave 
  128. 306 396 translate cutline 
  129.  
  130. Fontname3 findfont Size3 scalefont setfont
  131. -306 -396 translate LM TM moveto  
  132. .8 setgray
  133. background ( ) eq {/background (                 ) def} if
  134. background fillpage clip
  135.  
  136. grestore
  137. gsave
  138. 306 396 translate cutline2
  139. grestore
  140. % Place the badge 4 times on page
  141. gsave 306 396 translate  Badge grestore % upper left
  142.  
  143. % lets try one name
  144. gsave 
  145.   Size4 Name fitit 
  146. 306 Name stringwidth pop  2 div sub 396 moveto Name show grestore
  147.  
  148.  
  149. % /#copies 1 def    % number of pages
  150. showpage
  151.